<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title th:text="${tire.id != null} ? '编辑轮胎' : '添加轮胎'"></title>
  <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-4">
  <h1 th:text="${tire.id != null} ? '编辑轮胎信息' : '添加新轮胎'"></h1>

  <form th:action="@{/api/tires/add}" th:object="${tire}" method="post">
    <div class="row">
      <div class="col-md-6">
        <div class="mb-3">
          <label for="tireNumber" class="form-label">轮胎号 *</label>
          <input type="text" class="form-control" id="tireNumber" th:field="*{tireNumber}" required>
        </div>

        <div class="mb-3">
          <label for="vehiclePlateNumber" class="form-label">车头牌号</label>
          <input type="text" class="form-control" id="vehiclePlateNumber" th:field="*{vehiclePlateNumber}">
        </div>

        <div class="mb-3">
          <label for="trailerPlateNumber" class="form-label">挂车牌号</label>
          <input type="text" class="form-control" id="trailerPlateNumber" th:field="*{trailerPlateNumber}">
        </div>

        <div class="mb-3">
          <label for="tireBrand" class="form-label">轮胎品牌</label>
          <input type="text" class="form-control" id="tireBrand" th:field="*{tireBrand}">
        </div>

        <div class="mb-3">
          <label for="tireModel" class="form-label">轮胎型号</label>
          <input type="text" class="form-control" id="tireModel" th:field="*{tireModel}">
        </div>
      </div>

      <div class="col-md-6">
        <div class="mb-3">
          <label for="installDate" class="form-label">装胎日期</label>
          <input type="date" class="form-control" id="installDate" th:field="*{installDate}">
        </div>

        <div class="mb-3">
          <label for="installMileage" class="form-label">装胎公里数</label>
          <input type="number" class="form-control" id="installMileage" th:field="*{installMileage}">
        </div>

        <div class="mb-3">
          <label for="tirePrice" class="form-label">轮胎单价</label>
          <input type="number" step="0.01" class="form-control" id="tirePrice" th:field="*{tirePrice}">
        </div>

        <div class="mb-3">
          <label for="installCost" class="form-label">装胎费用</label>
          <input type="number" step="0.01" class="form-control" id="installCost" th:field="*{installCost}">
        </div>
      </div>
    </div>

    <button type="submit" class="btn btn-primary">保存</button>
    <a href="/api/tires" class="btn btn-secondary">取消</a>
  </form>
</div>
</body>
</html>